package com.itheima.多线程.基础;

public class 死锁 {
    public static void main(String[] args) {
        Object oa = new Object();
        Object ob = new Object();
        new Thread(() -> {
            while (true) {
                synchronized (oa) {
                    synchronized (ob) {
                        System.out.println("小康在走路................");
                    }
                }
            }
        }).start();
        new Thread(() -> {
            while (true) {
                synchronized (ob) {
                    synchronized (oa) {
                        System.out.println("小微在走路................");
                    }
                }
            }
        }).start();
    }
}
